//
//  SXWeatherIndexTableViewCell.m
//  ShiXun
//
//  Created by lanou on 15/11/4.
//  Copyright © 2015年 张琪. All rights reserved.
//

#import "SXWeatherIndexTableViewCell.h"

@implementation SXWeatherIndexTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, 80, 20)];
        _titleLabel.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_titleLabel];
        
        _introductionLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 5, kScreenWidth - 130, 20)];
        _introductionLabel.font = [UIFont systemFontOfSize:15];
        _introductionLabel.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_introductionLabel];
        
        _declabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 30, kScreenWidth - 20, 40)];
        _declabel.numberOfLines = 0;
        _declabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_declabel];
        
        _decButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _decButton.frame = CGRectMake(kScreenWidth - 30, 5, 20, 20);
        [_decButton setBackgroundImage:[UIImage imageNamed:@"SX-yousanjiao"] forState:(UIControlStateNormal)];
        [_decButton setBackgroundImage:[UIImage imageNamed:@"SX-xiasanjiao"] forState:(UIControlStateSelected)];
        [self.contentView addSubview:_decButton];
        
        self.layer.masksToBounds = YES;
    }
    return self;
}

- (void)setConfigureModel:(SXWeatherIndexModel *)configureModel
{
    _configureModel = configureModel;
    
    if ([configureModel.title isEqualToString:@"chuanyi"])
    {
        _titleLabel.text = @"穿衣";
    }
    else if ([configureModel.title isEqualToString:@"ganmao"])
    {
        _titleLabel.text = @"感冒";
    }
    else if ([configureModel.title isEqualToString:@"kongtiao"])
    {
        _titleLabel.text = @"空调";
    }
    else if ([configureModel.title isEqualToString:@"wuran"])
    {
        _titleLabel.text = @"污染";
    }
    else if ([configureModel.title isEqualToString:@"xiche"])
    {
        _titleLabel.text = @"洗车";
    }
    else if ([configureModel.title isEqualToString:@"yundong"])
    {
        _titleLabel.text = @"运动";
    }
    else
    {
        _titleLabel.text = @"紫外线";
    }
    _decButton.selected = configureModel.isShow;
    _introductionLabel.text = configureModel.introduction;
    _declabel.text = configureModel.dec;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
